package org.mspring.platform.dao.hibernate;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.mspring.platform.dao.Page;
import org.mspring.platform.dao.hibernate.common.CriteriaQuery;
import org.mspring.platform.dao.hibernate.common.EnhancedRule;
import org.mspring.platform.dao.query.QueryBuilder;

/**
 *
 * @author Gao Youbo
 * @since 2013年7月22日
 */
public interface IBaseDao {

    List<?> list(String hql, Object... params);

    List<?> list(Class<?> entityClass, EnhancedRule enhancedRule);

    List<?> list(CriteriaQuery criteriaQuery);

    List<?> list(QueryBuilder queryBuilder);

    List<?> list(DetachedCriteria detachedCriteria);

    List<?> list(DetachedCriteria criteria, int firstResult, int maxResults);

    int executeUpdate(String hql, Object... params);

    void delete(Class<?> entityClass, Serializable... id);

    void delete(Object entity);

    void update(Object entity);

    <T> T get(Class<T> entityClass, Serializable id);

    List<?> listAll(Class<?> entityClass);

    Object getBy(Class<?> entityClass, String property, Object value);

    Object uniqueResult(String hql, Object... params);

    Page<?> listPage(Class<?> entityClass, Page<?> page);

    Page<?> listPage(QueryBuilder queryBuilder, Page<?> page);

    Page<?> listPage(String hql, Page<?> page, Object... params);

    Page<?> listPage(CriteriaQuery criteriaQuery, Page<?> page);

    Serializable insert(Object entity);

    Object merge(Object entity);

    int count(String hql, Object... params);

    int count(Class<?> entityClass, EnhancedRule enhancedRule);

}
